package project.dbaccesslayer;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Table_Questions_To_Ignore {

	public static void saveQuestionId(Connection conn, Long id,
			String ignoreReason) throws SQLException {

		PreparedStatement s = conn.prepareStatement("SELECT Question_Id "
				+ "FROM Questions_To_Ignore " + "WHERE Question_Id = ? "
				+ "LIMIT 1");
		s.setLong(1, id);
		if (s.executeQuery().next()) {
			return;
		}

		s = conn.prepareStatement("INSERT INTO Questions_To_Ignore"
				+ "(Question_Id, Reason_To_Ignore) VALUES(?, ?)");
		s.setLong(1, id);
		s.setString(2, ignoreReason);
		s.executeUpdate();
	}

}
